package com.zombie.state;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.zombie.Constants;
import com.zombie.ResourceManager;
import com.zombie.input.Input;
import com.zombie.ui.MenuUI;
import com.zombie.util.state.BasicGameState;
import com.zombie.util.state.State;

public class MenuState extends BasicGameState {

	private static MenuState instance = new MenuState();
	private SpriteBatch batch;
	private OrthographicCamera camera;
	MenuUI ui;

	public static MenuState getInstance(){
		return instance;
	}
	
	@Override
	public int getID() {
		return Constants.STATE_MENU;
	}

	@Override
	public void init() {
		batch = new SpriteBatch();
		ui = new MenuUI();
		ui.init();
		camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
		camera.setToOrtho(false);
		ui.add(this);

	}

	@Override
	public void render() {
		batch.setProjectionMatrix(camera.combined);
		batch.begin();
		ResourceManager.getImage("menu").draw(batch);
		batch.end();
		draw();
	}

	@Override
	public void update(float delta) {
		act(delta);

	}

	@Override
	public void enter(State from) {
		Input.addInputProcessor(this);
	}

	@Override
	public void leave(State to) {
		Input.removeInputProcessor(this);
	}

	@Override
	public void resize(int width, int height) {
		// TODO Auto-generated method stub
		
	}


}
